package com.zhaodi.mybatisflexdemo.entity.bo;

import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.RelationManyToMany;
import com.mybatisflex.core.keygen.KeyGenerators;
import com.zhaodi.mybatisflexdemo.entity.TbSysPermission;
import com.zhaodi.mybatisflexdemo.entity.TbSysRole;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * @ClassName TbSysRoleBo
 * @Description TODO
 * @Author 郭敖
 * @Date 2024年09月17日 22:44
 * @Version 1.0
 */
@Data
public class TbSysRoleBo implements Serializable {
    @Serial
    private static final long serialVersionUID = -4403315111976882157L;
    /**
     * id
     */
    @Id(keyType = KeyType.Generator,value = KeyGenerators.snowFlakeId)
    private Integer id;

    /**
     * 角色编码
     */
    private String roleCode;

    /**
     * 角色名称
     */
    private String roleName;

    /**
     * 描述
     */
    private String description;

    /**
     * 是否删除：0正常1删除
     */
    private String state;

    @RelationManyToMany(
            selfField = "id", // 当前实体类的属性
            joinTable = "tb_sys_role_permission", // 中间表
            joinSelfColumn = "role_id", // 当前表和中间表的关系字段
            targetField = "id", // 目标对象的关系实体类的属性
            joinTargetColumn = "permission_id" // 目标表和中间表的关系字段
    )
    private List<TbSysPermission> permissionList;
}
